package by.amakarevich.services;

import java.util.List;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.amakarevich.datamodel.ShoppingCart;
import by.amakarevich.datamodel.ShoppingCartInfo;
import by.amakarevich.datamodel.Product;

public interface ShoppingCartInfoService {
	@Transactional
	void addNewShoppingCartInfo(ShoppingCartInfo shoppingCartInfo,  Product product, ShoppingCart shoppingCart);
	
	@Transactional
	ShoppingCartInfo get(Long id);
	
	@Transactional
	void updateShoppingCartInfo(ShoppingCartInfo shoppingCartInfo);
	
	@Transactional
    void deleteAll();
	
	List<ShoppingCartInfo> getAllShoppingCartInfo();

    List<ShoppingCartInfo> getAllShoppingCartInfoByShoppingCart(SingularAttribute<ShoppingCartInfo, ?> attr, boolean ascending, int startRecord, int pageSize);
    
    @Transactional
    void deleteShoppingCartInfo(Long id);
	
    ShoppingCartInfo getShoppingCartInfo(ShoppingCart shoppingCart, Product product);
    
    List<ShoppingCartInfo> getAllByShoppingCart(ShoppingCart shoppingCart);
    
    /*Only for not null ShoppingCart*/
    @Transactional
    ShoppingCartInfo getByShoppingCartId(Long shoppingCartInfoId);
    
}
